package main.java.com.ty;

import main.java.com.hik1.HCNetSDK;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DeviceConfig {

    public static String set(String deviceName, int i) {
        String[] ss = {
                "办公大楼$192.168.100.166$tyhk888888.",
                "二车间考勤$192.168.200.165$tyhk888888.",
                "车间考勤一$192.168.200.166$tyhk888888.",
                "车间大门$192.168.200.167$tyhk880308.",
                "车间一大门$192.168.200.168$tyhk888888.",
                "车间体温$192.168.100.169$tyhk888888."};
        for (String s : ss) {
            if (s.startsWith(deviceName)) {
                String[] sss = s.split("\\$");
                if (sss.length > i) return sss[i];
            }
        }
        return "";
    }
    //时间格式转换
    public static HCNetSDK.NET_DVR_TIME getHkTime(Date time) {
        HCNetSDK.NET_DVR_TIME structTime = new HCNetSDK.NET_DVR_TIME();
        String str = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(time);
        String[] times = str.split("-");
        structTime.dwYear = Integer.parseInt(times[0]);
        structTime.dwMonth = Integer.parseInt(times[1]);
        structTime.dwDay = Integer.parseInt(times[2]);
        structTime.dwHour = Integer.parseInt(times[3]);
        structTime.dwMinute = Integer.parseInt(times[4]);
        structTime.dwSecond = Integer.parseInt(times[5]);
        return structTime;
    }
}
